
package com.jiuzhe.commercial.ui.components;

import android.view.Gravity;

public class ReportTitleStruct {

	// =========================================================================

    public enum ALIGN
    {
        TPCIA_UNKNOWN,
        TPCIA_TOP,
        TPCIA_BOTTOM,
        TPCIA_LEFT,
        TPCIA_RIGHT,
        TPCIA_CENTER,
        TPCIA_CLIENT
    };
	
	/**
	 * title content
	 */
	private String mTitle;
	
	/**
	 * title id
	 */
	private String mTitleName;
	
	/**
	 * fixed or not
	 */
	private boolean mIsFixed;
	
	/**
	 * title color
	 */
	private int mTitleColorId;
	
	/**
	 * title dimension
	 */
	private int mTitleDimen;
	
	/**
	 * title font
	 */
	private int mTitleFont;
	
	/**
	 * title alignment
	 */
	private int mAlignment;
	
	/**
	 * split width or border width
	 */
	private int mBorderWidth;
	
	/**
	 * click-able
	 */
	private boolean mClickable;
	
	/**
	 * order-able
	 */
	private boolean mOrderable;
	
	/**
	 * current click column order style
	 */
	private int orderStyle = -1;

	/**
	 * column title visible or not
	 */
	private boolean mVisible;

	/**
	 * background resource or color
	 */
	private int mBackgroundResourceId;
	
	/**
	 * position row
	 */
	private int mPositionRow;
	
	/**
	 * position column
	 */
	private int mPositionColumn;
	
	/**
	 * title container width
	 */
	private float mTitleContainerWidth;
	
	/**
	 * title container height
	 */
	private float mTitleContainerHeight;
	
	/**
	 * max children count
	 */
	private int mSaturability;
	
	/**
	 * children of title
	 */
	private ReportTitleStruct[] mTitleChildren;
	
	/**
	 * report title structure
	 */
	private ReportTitleStruct mReportTitleStruct;
	
	/**
	 * left
	 */
	private float mTitleContainerLeft;

	/**
	 * top
	 */
	private float mTitleContainerTop;
	
	/**
	 * data type
	 */
	private String mDataType;
	
	/**
	 * data format
	 */
	private String mDataFormat;
	/**
	 * title tail
	 */
	private String mTitleTail;
	/**
	 * 鎶ヨ〃灞傜殑name锛岃幏鍙栨暟鎹殑鏃跺�瑕佸甫涓婅繖涓墠鑳借幏鍙栧埌
	 */
	private String reportLayerName;
	
	// =========================================================================


	/**
	 * @ use this one!!
	 * this constructor is used for all parameters
	 * constructor with children
	 * @param title
	 * @param titleName
	 * @param titleColorId
	 * @param titleDimen
	 * @param titleFont
	 * @param alignment
	 * @param borderWidth
	 * @param clickable
	 * @param orderable
	 * @param orderStyle
	 * @param visible
	 * @param backgroundResourceId
	 * @param positionRow
	 * @param positionColumn
	 * @param titleContainerWidth
	 * @param titleContainerHeight
	 * @param saturability
	 * @param titleChildren
	 */
	public ReportTitleStruct(String title, String titleName, boolean isFixed,
			int titleColorId, int titleDimen, int titleFont, int alignment,
			int borderWidth, boolean clickable, boolean orderable,
			int orderStyle, boolean visible, int backgroundResourceId,
			int positionRow, int positionColumn, int titleContainerWidth,
			int titleContainerHeight, int saturability,
			ReportTitleStruct[] titleChildren) {
		super();
		this.mTitle = title;
		this.mTitleName = titleName;
		this.mIsFixed = isFixed;
		this.mTitleColorId = titleColorId;
		this.mTitleDimen = titleDimen;
		this.mTitleFont = titleFont;
		this.mAlignment = alignment;
		this.mBorderWidth = borderWidth;
		this.mClickable = clickable;
		this.mOrderable = orderable;
		this.orderStyle = orderStyle;
		this.mVisible = visible;
		this.mBackgroundResourceId = backgroundResourceId;
		this.mPositionRow = positionRow;
		this.mPositionColumn = positionColumn;
		this.mTitleContainerWidth = titleContainerWidth;
		this.mTitleContainerHeight = titleContainerHeight;
		this.mSaturability = saturability;
		this.mTitleChildren = titleChildren;
	}

	/**
	 * 玖折适用
	 * @param mTitle
	 * @param mTitleChildren
	 */
	public ReportTitleStruct(String mTitle, ReportTitleStruct[] mTitleChildren) {
		this.mTitle = mTitle;
		this.mTitleChildren = mTitleChildren;
	}

	/**
	 * constructor without children
	 * @param title
	 * @param titleName
	 * @param titleColorId
	 * @param titleDimen
	 * @param titleFont
	 * @param alignment
	 * @param borderWidth
	 * @param clickable
	 * @param orderable
	 * @param orderStyle
	 * @param visible
	 * @param backgroundResourceId
	 * @param positionRow
	 * @param positionColumn
	 * @param titleContainerWidth
	 * @param titleContainerHeight
	 * @param saturability
	 */
	public ReportTitleStruct(String title, String titleName, boolean isFixed,
			int titleColorId, int titleDimen, int titleFont, int alignment,
			int borderWidth, boolean clickable, boolean orderable,
			int orderStyle, boolean visible, int backgroundResourceId,
			int positionRow, int positionColumn, int titleContainerWidth,
			int titleContainerHeight, int saturability) {
		super();
		this.mTitle = title;
		this.mTitleName = titleName;
		this.mIsFixed = isFixed;
		this.mTitleColorId = titleColorId;
		this.mTitleDimen = titleDimen;
		this.mTitleFont = titleFont;
		this.mAlignment = alignment;
		this.mBorderWidth = borderWidth;
		this.mClickable = clickable;
		this.mOrderable = orderable;
		this.orderStyle = orderStyle;
		this.mVisible = visible;
		this.mBackgroundResourceId = backgroundResourceId;
		this.mPositionRow = positionRow;
		this.mPositionColumn = positionColumn;
		this.mTitleContainerWidth = titleContainerWidth;
		this.mTitleContainerHeight = titleContainerHeight;
		this.mSaturability = saturability;
	}
	/**
	 * @author yhh
	 * 鏋勯�鍑芥暟
	 */
	public ReportTitleStruct(String titleName,float mTitleContainerLeft, float mTitleContainerTop,float mTitleContainerWidth,float mTitleContainerHeight, ReportTitleStruct[] titleChildren){
		this.mTitleName = titleName;
		this.mTitleContainerLeft = mTitleContainerLeft;
		this.mTitleContainerTop = mTitleContainerTop;
		this.mTitleContainerWidth = mTitleContainerWidth;
		this.mTitleContainerHeight = mTitleContainerHeight;
		this.mTitleChildren = titleChildren;
	}


	public ReportTitleStruct() {
		super();
	}
	
	public ReportTitleStruct(String title) {
		super();
		this.mTitle = title;
	}
	
	public ReportTitleStruct(String title, boolean clickable, boolean visible) {
		super();
		this.mTitle = title;
		this.mClickable = clickable;
		this.mVisible = visible;		
	}
	
	/**
	 * 
	 * @param title
	 * @param clickable
	 * @param orderable
	 * @param orderStyle
	 * @param visible
	 */
	public ReportTitleStruct(String title, boolean isFixed, boolean clickable, boolean orderable, int orderStyle, boolean visible, int saturability,
			ReportTitleStruct[] titleChildren) {
		super();
		this.mTitle = title;
		this.mIsFixed = isFixed;
		this.mClickable = clickable;
		this.mOrderable = orderable;
		this.orderStyle = orderStyle;
		this.mVisible = visible;
		this.mSaturability = saturability;
		this.mTitleChildren = titleChildren;
	}
	
	/**
	 * @param child_nWidth 瀹�
	 * @param child_strTitle 棰樼洰
	 * @param child_strName 鍚嶅瓧id
	 * @param child_isFixed 鍥哄畾鍒�
	 * @param child_strDatatype 鏁版嵁绫诲瀷
	 * @param child_strDatafmt 鏁版嵁鏍煎紡
	 * @param child_bVisible 鏄鹃殣
	 * @param child_enumAlign 瀵归綈鏂瑰紡
	 * @param child_Left 璺濆乏
	 * @param child_Top 璺濅笂
	 */
	public ReportTitleStruct(float child_nWidth, String child_strTitle, String child_strName,
                             boolean child_isFixed, String child_strDatatype, String child_strDatafmt,
                             boolean child_bVisible, ReportBaseObject.ALIGN child_enumAlign,
                             float child_Left, float child_Top, ReportTitleStruct[] reportTitleStructChild, String child_strTail){
		
		this.mTitleContainerWidth = child_nWidth ;
		this.mTitle = child_strTitle ;
		this.mTitleName = child_strName ;
		this.mIsFixed = child_isFixed ;
		this.mDataType = child_strDatatype ;
		this.mDataFormat = child_strDatafmt ;
		this.mVisible = child_bVisible ;
		this.mAlignment = getAlign( child_enumAlign ) ;
		this.mTitleContainerLeft = child_Left ;
		this.mTitleContainerTop = child_Top ;
		this.mTitleChildren = reportTitleStructChild ;
		this.mTitleTail = child_strTail;
	}
	
	// =========================================================================

	// ~ 鏂规硶鍖哄潡
	
	
	public ReportTitleStruct getReportTitleStructByTitle(String title) {
		/**
		 * hash-table to get reportTitleStruct
		 * need to be altered
		 */
		return mReportTitleStruct;
	}
	
	/**
	 * set alignment
	 * @param child_enumAlign
	 * @return
	 */
	public int getAlign( ReportBaseObject.ALIGN child_enumAlign ) {
		int align = -1;
		switch ( child_enumAlign ) {
		case	TPCIA_LEFT :
			align = Gravity.LEFT;
			break;
			
		case	TPCIA_RIGHT :
			align = Gravity.RIGHT;
			break;
			
		case	TPCIA_CENTER :			
		default:
			align = Gravity.CENTER;
			break;
		}
		
		return align;
	}
	
	public String getmTitle() {
		return mTitle;
	}

	public void setmTitle(String title) {
		this.mTitle = title;
	}

	public String getmTitleName() {
		return mTitleName;
	}

	public void setmTitleName(String titleName) {
		this.mTitleName = titleName;
	}

	public boolean ismIsFixed() {
		return mIsFixed;
	}

	public void setmIsFixed(boolean isFixed) {
		this.mIsFixed = isFixed;
	}
	
	public int getmTitleColorId() {
		return mTitleColorId;
	}

	public void setmTitleColorId(int titleColorId) {
		this.mTitleColorId = titleColorId;
	}

	public int getmTitleDimen() {
		return mTitleDimen;
	}

	public void setmTitleDimen(int titleDimen) {
		this.mTitleDimen = titleDimen;
	}

	public int getmTitleFont() {
		return mTitleFont;
	}

	public void setmTitleFont(int titleFont) {
		this.mTitleFont = titleFont;
	}

	public int getmAlignment() {
		return mAlignment;
	}

	public void setmAlignment(int alignment) {
		this.mAlignment = alignment;
	}

	public int getmBorderWidth() {
		return mBorderWidth;
	}

	public void setmBorderWidth(int borderWidth) {
		this.mBorderWidth = borderWidth;
	}

	public boolean getmClickable() {
		return mClickable;
	}

	public void setmClickable(boolean clickable) {
		this.mClickable = clickable;
	}

	public boolean ismOrderable() {
		return mOrderable;
	}

	public void setmOrderable(boolean orderable) {
		this.mOrderable = orderable;
	}
	
	public int getOrderStyle() {
		return orderStyle;
	}

	public void setOrderStyle(int orderStyle) {
		this.orderStyle = orderStyle;
	}
	
	public boolean ismVisible() {
		return mVisible;
	}

	public void setmVisible(boolean visible) {
		this.mVisible = visible;
	}
	
	public int getmBackgroundResourceId() {
		return mBackgroundResourceId;
	}

	public void setmBackgroundResourceId(int backgroundResourceId) {
		this.mBackgroundResourceId = backgroundResourceId;
	}

	public int getmPositionRow() {
		return mPositionRow;
	}

	public void setmPositionRow(int positionRow) {
		this.mPositionRow = positionRow;
	}

	public int getmPositionColumn() {
		return mPositionColumn;
	}

	public void setmPositionColumn(int positionColumn) {
		this.mPositionColumn = positionColumn;
	}

	public float getmTitleContainerWidth() {
		return mTitleContainerWidth;
	}

	public void setmTitleContainerWidth(int titleContainerWidth) {
		this.mTitleContainerWidth = titleContainerWidth;
	}

	public float getmTitleContainerHeight() {
		return mTitleContainerHeight;
	}

	public void setmTitleContainerHeight(int titleContainerHeight) {
		this.mTitleContainerHeight = titleContainerHeight;
	}

	public int getmSaturability() {
		return mSaturability;
	}

	public void setmSaturability(int saturability) {
		this.mSaturability = saturability;
	}

	public ReportTitleStruct[] getmTitleChildren() {
		return mTitleChildren;
	}

	public void setmTitleChildren(ReportTitleStruct[] titleChildren) {
		this.mTitleChildren = titleChildren;
	}
	
	public float getmTitleContainerLeft() {
		return mTitleContainerLeft;
	}

	public void setmTitleContainerLeft(int mTitleContainerLeft) {
		this.mTitleContainerLeft = mTitleContainerLeft;
	}

	public float getmTitleContainerTop() {
		return mTitleContainerTop;
	}

	public void setmTitleContainerTop(int mTitleContainerTop) {
		this.mTitleContainerTop = mTitleContainerTop;
	}

	/**
	 * 鑾峰彇
	 * 
	 * @return the mDataType
	 */
	public String getmDataType() {
		return mDataType;
	}

	/**
	 * 璁剧疆
	 * 
	 * @param mDataType the mDataType to set
	 */
	public void setmDataType(String mDataType) {
		this.mDataType = mDataType;
	}

	/**
	 * 鑾峰彇
	 * 
	 * @return the mDataFormat
	 */
	public String getmDataFormat() {
		return mDataFormat;
	}

	/**
	 * 璁剧疆
	 * 
	 * @param mDataFormat the mDataFormat to set
	 */
	public void setmDataFormat(String mDataFormat) {
		this.mDataFormat = mDataFormat;
	}

	public String getmTitleTail() {
		return mTitleTail;
	}

	public void setmTitleTail(String mTitleTail) {
		this.mTitleTail = mTitleTail;
	}
	
	// =========================================================================

	// ~ 闈欐�鏂规硶鍖哄潡
	// =========================================================================

	// ~ 鍐呴儴鎺ュ彛锛堢被锛夊尯鍧�
	// =========================================================================
}

